/////////////////////////////////////////////////////////////////////////////////////
//
//		File Name		:		CMasterHand.cpp
//
//		Author			:		Lane Shapiro
//
//		Purpose			:		All functions and members of the CMasterHand class
//
//		Dates			:		Written( April 1, 2011 ) by Lane Shapiro
//	
/////////////////////////////////////////////////////////////////////////////////////

#include "CMasterHand.h"

#include "../managers/vin_objectmanager.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "../Game states/CGamePlayState.h"
#include "../Managers/vin_soundmanager.h"
#include "../Managers/InputManager.h"
#include "../Core/VIN_EventSystem.h"
#include "../Core/MessageSystem.h"
#include "../core/cgame.h"
#include "CEnemy.h"
#include "CRock.h"

enum EState {HAND_IDLE, HAND_PINCH, HAND_POISON};

CMasterHand::CMasterHand()
{
	currAnimation = HAND_IDLE;

	currAnimation2 = 0;

	Load2("resources/XML/LvlUp.xml");

	Load("resources/XML/Hand_Animation.xml");

	SetType(OBJ_HAND);

	scale = 1.5f;
	SetGroundPt(501);
	holdingEnemy = false;
	holdingPinch = false;
	rockActive = false;
	poison = false;

	rockEquiped = false;

	levelUp = false;

	pinchTimer = 0.0f;
	HotOilTimer = 0.0f;
	pinchTimerMax = 0.05f;
	rockTimer = 0.5f;

	HotOilTimer = 0.0f;
	HotOilCoolDown = BallistaCoolDown = RockCoolDown = poisonCooldown = ArcherCoolDown = 0;
	poisonCooldownMax = RockCoolDownMax = ArcherCoolDownMax = 15.0f;
	BallistaCoolDownMax = HotOilCoolDownMax = 30.0f;

	level = RockLevel = 1;
	ArcherLevel = 0;
	xp = 0.0f;
	neededxp = 100.0f;
}

CMasterHand::~CMasterHand()
{

}

void CMasterHand::Render()
{
	CSGD_TextureManager* pTM  = CSGD_TextureManager::GetInstance();
	CSGD_Direct3D* d3d  = CSGD_Direct3D::GetInstance();

	if( HotOilTimer > 0.0f)
	{
		pTM->Draw(MessageSystem::GetInstance()->GetStaticImageID(IMAGE_SPLAT), (int)(CGamePlayState::GetInstance()->GetPlayer()->GetPosX() - 60), (int)CGamePlayState::GetInstance()->GetPlayer()->GetPosY() + 350, 2.50f, 2.50f);
		pTM->Draw(MessageSystem::GetInstance()->GetStaticImageID(IMAGE_SPILL), (int)(CGamePlayState::GetInstance()->GetPlayer()->GetPosX() - 25), (int)CGamePlayState::GetInstance()->GetPlayer()->GetPosY() + 250, 1.25f, 1.0f);
		// Play Spilling sound
	}

	if(!rockEquiped)
	{
		if(poison)
		{		
			vAnimation[currAnimation].Render(GetPosX() , GetPosY() + 40 , false , scale);
		}
		else
			vAnimation[currAnimation].Render(GetPosX() , GetPosY() , false , scale);
	}
	else
	{
		pTM->Draw( MessageSystem::GetInstance()->GetStaticImageID(IMAGE_WALNUT), (int)GetPosX() - 32, (int)GetPosY(), 1.0f, 1.0f );
	}

	d3d->GetSprite()->Flush();

	if(levelUp)
	{
		float tempScale = 1.3f;
		vAnimation2[currAnimation2].Render(GetPosX(), GetPosY() , false , tempScale);
	}

	d3d->GetSprite()->Flush();

	// d3d->DrawRect(GetCollisionRect(), 255, 0, 0);

	if(poison)
	{		
		RECT poisonrect;
		SetRect(&poisonrect, (int)GetPosX() - 50, (int)GetPosY() - 40, (int)GetPosX() + 50, (int)GetPosY() + 40);
		//d3d->DrawRect(poisonrect, 0, 255, 0);

	}
}

bool CMasterHand::Input()
{
	if(InputManager::GetInstance()->EquiptBoulder())
	{
		EquiptRock();
	}

	if(InputManager::GetInstance()->EquiptPinch())
	{
		EquiptPinch();
	}

	if(InputManager::GetInstance()->EquiptPoison())
	{
		EquiptPoison();
	}

	if(!poison && !rockEquiped)
	{
		if(pinchTimer >= pinchTimerMax)
		{
			if(InputManager::GetInstance()->Action())
			{
				holdingPinch = true;
				currAnimation = HAND_PINCH;
				pinchTimer = 0.0f;
		
				return true;
			}
			else
			{
				holdingPinch = false;
			}
		}
	}
	
	if(rockEquiped)
	{
		if(InputManager::GetInstance()->Action() && rockTimer < 0 && CGamePlayState::GetInstance()->GetHand()->GetCursorBox().top > 100)
		{
			if(rockActive == false)
			{
				if(CGamePlayState::GetInstance()->GetPlayer()->GetCash() >= (250 * RockLevel))
				{
					if(RockCoolDown >= RockCoolDownMax)
					{
						MessageSystem::GetInstance()->SendNewMessage(new CCreateRockMessage(GetPosX(), GetPosY(), CGamePlayState::GetInstance()->GetHand()->GetRockLevel()));
						RockCoolDown = 0;
						rockActive = true;
						rockEquiped = false;
						poison = false;
						currAnimation = HAND_IDLE;
						scale = 1.5f;
						VIN_SoundManager::GetInstance()->PlayRock();
						CGamePlayState::GetInstance()->GetPlayer()->SetCash(CGamePlayState::GetInstance()->GetPlayer()->GetCash() - (250 * GetRockLevel()));
					}
				}
			}		
			return true;
		}
	}
	return false;
}
RECT CMasterHand::GetCollisionRect()
{
	RECT temp;
	if(currAnimation < (int)vAnimation.size())
	{
		temp.left  = (int)GetPosX() + vAnimation[currAnimation].GetHealthFrame().left;
		temp.right = (int)GetPosX() + vAnimation[currAnimation].GetHealthFrame().right;
		temp.top   = (int)GetPosY() + vAnimation[currAnimation].GetHealthFrame().top;
		temp.bottom= (int)GetPosY() + vAnimation[currAnimation].GetHealthFrame().bottom;
		return temp;
	}
	else
	{
		SetRect(&temp,0,0,0,0);
		return temp;
	}
}

void CMasterHand::Update(float fElapsedTime)
{
	if(pinchTimer < pinchTimerMax)
	{
		//if(currAnimation != HAND_PINCH)
			pinchTimer += (fElapsedTime*0.62f);
	}
	else if(pinchTimer > pinchTimerMax)
		pinchTimer = pinchTimerMax;

	rockTimer -= fElapsedTime;

	Input();

	SetPosX((float)InputManager::GetInstance()->CursorPosition().x);
	SetPosY((float)InputManager::GetInstance()->CursorPosition().y);

	vAnimation[currAnimation].Update(fElapsedTime);
	vAnimation[currAnimation].Play();

	if(poison)
	{
		VIN_SoundManager::GetInstance()->PlayWoosh();
		if(poisonCooldown <= 0)
		{
			EquiptPinch();
		}
	}

	if(currAnimation == HAND_POISON)
	{
		if(poisonCooldown >= 0)
			poisonCooldown -= (fElapsedTime*1.1f);
	}
	else if(poisonCooldown <= poisonCooldownMax)
		poisonCooldown += fElapsedTime;

	if(RockCoolDown <= RockCoolDownMax)
		RockCoolDown += fElapsedTime;
	if(BallistaCoolDown <= BallistaCoolDownMax)
		BallistaCoolDown += fElapsedTime;
	if(HotOilCoolDown <= HotOilCoolDownMax)
		HotOilCoolDown += fElapsedTime;
	if(ArcherCoolDown <= ArcherCoolDownMax)
		ArcherCoolDown += fElapsedTime;

	if( HotOilTimer > 0.0f)
	{
		HotOilTimer -= fElapsedTime;
		VIN_EventSystem::GetInstance()->SendEvent("HotOil");
	}
	else
		HotOilTimer = 0.0f;

	if( BallistaTimer > 0.0f)
	{
		BallistaTimer -= fElapsedTime;
		VIN_EventSystem::GetInstance()->SendEvent("Ballista");
	}
	else
		BallistaTimer = 0.0f;

	if(currAnimation == HAND_PINCH)
	{
		if(vAnimation[currAnimation].GetCurFrame() >= vAnimation[currAnimation].GetMaxFrames() - 1)
		{
			if(holdingPinch == true)
			{
				if(vAnimation[currAnimation].Playing())
				vAnimation[currAnimation].Stop();
			}
			else
			{
				currAnimation = HAND_IDLE;
				vAnimation[currAnimation].Play();
			}
		}
	}
	else
	{
		holdingEnemy = false;
		//enemyInHand = NULL;
	}

	if(levelUp)
	{
		vAnimation2[currAnimation2].Update(fElapsedTime);
		vAnimation2[currAnimation2].Play();

		if(vAnimation2[currAnimation2].GetCurFrame() == vAnimation2[currAnimation2].GetMaxFrames() - 1)
		{
			levelUp = false;
		}
	}

	if(xp >= neededxp)
	{
		neededxp = (((neededxp + neededxp) * 4.0f) * .5f) - xp; 
		level++;
		xp = 0;
		levelUp = true;
		//vAnimation2[currAnimation2].Stop();
		vAnimation2[currAnimation2].SetCurFrame(0);
		vAnimation2[currAnimation2].Play();
		VIN_SoundManager::GetInstance()->PlayLevelUp();
	}
}

bool CMasterHand::CheckCollision( IBaseInterface* pBase)
{
	if(pBase->GetType() == OBJ_ENEMY)
	{
		CBaseEnemy* enemy = (CBaseEnemy*)pBase;

		RECT temp;

		if(IntersectRect(&temp, &GetCollisionRect(), &enemy->GetHealthRect()) )
		{
			if(currAnimation == HAND_PINCH)
			{
				//enemyInHand = enemy;
				//holdingEnemy = true;
				//enemyInHand->SetPosX(GetPosX());
				//enemyInHand->SetPosY(GetPosX());
				return true;
			}
		}		
	}
	return false;
}

bool CMasterHand::Load( const char* AnimInfo)
{
	int tempID;

	TiXmlDocument doc;

	if(doc.LoadFile(AnimInfo) == false)
		return false;

	TiXmlElement* Root = doc.RootElement();
	if(Root == NULL)
		return false;

	TiXmlElement* NumAnim = Root->FirstChildElement("xNumOfAnim");
	int count = atoi(NumAnim->GetText());

	TiXmlElement* ImageFile = Root->FirstChildElement("xImageFile");
	if(ImageFile)
	{
		tempID = CSGD_TextureManager::GetInstance()->LoadTexture(ImageFile->GetText());
	}

	TiXmlElement* xAnimation  = Root->FirstChildElement("xAnimation");

	while(xAnimation)
	{
		CAnimation a;

		TiXmlElement* NumFrame = xAnimation->FirstChildElement("xNumOfFrames");
		int fcount = atoi(NumFrame->GetText());

		TiXmlElement* looping = xAnimation->FirstChildElement("xLooping");
		a.SetIsLooping((bool)(atoi(looping->GetText())));

		TiXmlElement* AnimSpd = xAnimation->FirstChildElement("xAnimSpd");
		a.SetSpeed((float)( atoi(AnimSpd->GetText())));

		TiXmlElement* xFrame = xAnimation->FirstChildElement("xFrame");

		Frame temp;
		temp.fTime = 0;
		temp.ptAnchor.x = 0;
		temp.ptAnchor.y = 0;

		SetRect(&temp.rAttack,0,0,0,0);
		SetRect(&temp.rCollision,0,0,0,0);
		SetRect(&temp.rRender,0,0,0,0);

		temp.ptAnchor.x = 0;
		temp.ptAnchor.y = 0;

		while(xFrame)
		{
			TiXmlElement* xTime = xFrame->FirstChildElement("xTime");
			if(xTime)
			{
				temp.fTime =(float)( atoi(xTime->GetText()) );
			}
			TiXmlElement* FrameType = xFrame->FirstChildElement("xFrameType");
			if(FrameType)
			{
				TiXmlElement* RenderFrame = FrameType->FirstChildElement("xRenderFrame");
				if(RenderFrame)
				{
					TiXmlElement* RenderFrameX = RenderFrame->FirstChildElement("xRenderFrameX");
					if(RenderFrameX)
						temp.rRender.left =  atoi(RenderFrameX->GetText());

					TiXmlElement* RenderFrameY = RenderFrame->FirstChildElement("xRenderFrameY");
					if(RenderFrameY)
						temp.rRender.top = atoi(RenderFrameY->GetText());

					TiXmlElement* RenderFrameW = RenderFrame->FirstChildElement("xRenderFrameW");
					if(RenderFrameW)
					{
						temp.rRender.right = atoi(RenderFrameW->GetText());
						temp.rRender.right += temp.rRender.left;
					}

					TiXmlElement* RenderFrameH = RenderFrame->FirstChildElement("xRenderFrameH");
					if(RenderFrameH)
					{
						temp.rRender.bottom = atoi(RenderFrameH->GetText());
						temp.rRender.bottom += temp.rRender.top;
					}
				}

				TiXmlElement* CollisionFrame = FrameType->FirstChildElement("xCollisionFrame");
				if(CollisionFrame)
				{
					TiXmlElement* CollisionFrameX = CollisionFrame->FirstChildElement("xCollisionFrameX");
					if(CollisionFrameX)
						temp.rCollision.left = atoi(CollisionFrameX->GetText());

					TiXmlElement* CollisionFrameY = CollisionFrame->FirstChildElement("xCollisionFrameY");
					if(CollisionFrameY)
						temp.rCollision.top = atoi(CollisionFrameY->GetText());

					TiXmlElement* CollisionFrameW = CollisionFrame->FirstChildElement("xCollisionFrameW");
					if(CollisionFrameW)
						temp.rCollision.right = atoi(CollisionFrameW->GetText());

					TiXmlElement* CollisionFrameH = CollisionFrame->FirstChildElement("xCollsionFrameH");
					if(CollisionFrameH)
						temp.rCollision.bottom = atoi(CollisionFrameH->GetText());
				}

				TiXmlElement* AttackFrame = FrameType->FirstChildElement("xAttackFrame");
				if(AttackFrame)
				{
					TiXmlElement* AttackFrameX = AttackFrame->FirstChildElement("xAttackFrameX");
					if(AttackFrameX)
						temp.rAttack.left = atoi(AttackFrameX->GetText());

					TiXmlElement* AttackFrameY = AttackFrame->FirstChildElement("xAttackFrameY");
					if(AttackFrameY)
						temp.rAttack.top = atoi(AttackFrameY->GetText());

					TiXmlElement* AttackFrameW = AttackFrame->FirstChildElement("xAttackFrameW");
					if(AttackFrameW)
						temp.rAttack.right = atoi(AttackFrameW->GetText());

					TiXmlElement* AttackFrameH = AttackFrame->FirstChildElement("xAttackFrameH");
					if(AttackFrameH)
						temp.rAttack.bottom = atoi(AttackFrameH->GetText());
				}

				TiXmlElement* AnchorPoint = FrameType->FirstChildElement("xAnchorPoint");
				if(AnchorPoint)
				{
					TiXmlElement* AnchorPointX = AnchorPoint->FirstChildElement("xAnchorPointX");
					if(AnchorPointX)
					{
						int ax = atoi(AnchorPointX->GetText());
						temp.ptAnchor.x =  ax - temp.rRender.left;
					}

					TiXmlElement* AnchorPointY = AnchorPoint->FirstChildElement("xAnchorPointY");
					if(AnchorPointY)
					{
						int ay = atoi(AnchorPointY->GetText());
						temp.ptAnchor.y = ay - temp.rRender.top;
					}
				}
			}
			a.SetTimeDelay(temp.fTime);

			temp.rAttack.right +=  temp.rAttack.left;
			temp.rAttack.bottom += temp.rAttack.top;
			temp.rAttack.left -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rAttack.top -= (temp.ptAnchor.y + temp.rRender.top);
			temp.rAttack.right -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rAttack.bottom -=(temp.ptAnchor.y + temp.rRender.top);

			temp.rCollision.right +=  temp.rCollision.left;
			temp.rCollision.bottom += temp.rCollision.top;
			temp.rCollision.left -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rCollision.top -= (temp.ptAnchor.y + temp.rRender.top);
			temp.rCollision.right -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rCollision.bottom -=(temp.ptAnchor.y + temp.rRender.top);

			a.addFrame(temp);
			xFrame = xFrame->NextSiblingElement("xFrame");
		}
		a.SetImageID(tempID);
		vAnimation.push_back(a);

		xAnimation = xAnimation->NextSiblingElement("xAnimation");
	}
	return true;
}

RECT CMasterHand::GetCursorBox()
{
	InputManager* pIM = InputManager::GetInstance();
	RECT temp;

	//pDI->mouse
	SetRect(&temp, pIM->CursorPosition().x - 5,  pIM->CursorPosition().y -5, pIM->CursorPosition().x + 5,  pIM->CursorPosition().y + 5);

	return temp;
}


bool CMasterHand::Load2( const char* AnimInfo)
{
	int tempID;

	TiXmlDocument doc;

	if(doc.LoadFile(AnimInfo) == false)
		return false;

	TiXmlElement* Root = doc.RootElement();
	if(Root == NULL)
		return false;

	TiXmlElement* NumAnim = Root->FirstChildElement("xNumOfAnim");
	int count = atoi(NumAnim->GetText());

	TiXmlElement* ImageFile = Root->FirstChildElement("xImageFile");
	if(ImageFile)
	{
		tempID = CSGD_TextureManager::GetInstance()->LoadTexture(ImageFile->GetText());
	}

	TiXmlElement* xAnimation  = Root->FirstChildElement("xAnimation");

	while(xAnimation)
	{
		CAnimation a;

		TiXmlElement* NumFrame = xAnimation->FirstChildElement("xNumOfFrames");
		int fcount = atoi(NumFrame->GetText());

		TiXmlElement* looping = xAnimation->FirstChildElement("xLooping");
		a.SetIsLooping((bool)(atoi(looping->GetText())));

		TiXmlElement* AnimSpd = xAnimation->FirstChildElement("xAnimSpd");
		a.SetSpeed((float)( atoi(AnimSpd->GetText())));

		TiXmlElement* xFrame = xAnimation->FirstChildElement("xFrame");

		Frame temp;
		temp.fTime = 0;
		temp.ptAnchor.x = 0;
		temp.ptAnchor.y = 0;

		SetRect(&temp.rAttack,0,0,0,0);
		SetRect(&temp.rCollision,0,0,0,0);
		SetRect(&temp.rRender,0,0,0,0);

		temp.ptAnchor.x = 0;
		temp.ptAnchor.y = 0;

		while(xFrame)
		{
			TiXmlElement* xTime = xFrame->FirstChildElement("xTime");
			if(xTime)
			{
				temp.fTime =(float)( atoi(xTime->GetText()) );
			}
			TiXmlElement* FrameType = xFrame->FirstChildElement("xFrameType");
			if(FrameType)
			{
				TiXmlElement* RenderFrame = FrameType->FirstChildElement("xRenderFrame");
				if(RenderFrame)
				{
					TiXmlElement* RenderFrameX = RenderFrame->FirstChildElement("xRenderFrameX");
					if(RenderFrameX)
						temp.rRender.left =  atoi(RenderFrameX->GetText());

					TiXmlElement* RenderFrameY = RenderFrame->FirstChildElement("xRenderFrameY");
					if(RenderFrameY)
						temp.rRender.top = atoi(RenderFrameY->GetText());

					TiXmlElement* RenderFrameW = RenderFrame->FirstChildElement("xRenderFrameW");
					if(RenderFrameW)
					{
						temp.rRender.right = atoi(RenderFrameW->GetText());
						temp.rRender.right += temp.rRender.left;
					}

					TiXmlElement* RenderFrameH = RenderFrame->FirstChildElement("xRenderFrameH");
					if(RenderFrameH)
					{
						temp.rRender.bottom = atoi(RenderFrameH->GetText());
						temp.rRender.bottom += temp.rRender.top;
					}
				}

				TiXmlElement* CollisionFrame = FrameType->FirstChildElement("xCollisionFrame");
				if(CollisionFrame)
				{
					TiXmlElement* CollisionFrameX = CollisionFrame->FirstChildElement("xCollisionFrameX");
					if(CollisionFrameX)
						temp.rCollision.left = atoi(CollisionFrameX->GetText());

					TiXmlElement* CollisionFrameY = CollisionFrame->FirstChildElement("xCollisionFrameY");
					if(CollisionFrameY)
						temp.rCollision.top = atoi(CollisionFrameY->GetText());

					TiXmlElement* CollisionFrameW = CollisionFrame->FirstChildElement("xCollisionFrameW");
					if(CollisionFrameW)
						temp.rCollision.right = atoi(CollisionFrameW->GetText());

					TiXmlElement* CollisionFrameH = CollisionFrame->FirstChildElement("xCollsionFrameH");
					if(CollisionFrameH)
						temp.rCollision.bottom = atoi(CollisionFrameH->GetText());
				}

				TiXmlElement* AttackFrame = FrameType->FirstChildElement("xAttackFrame");
				if(AttackFrame)
				{
					TiXmlElement* AttackFrameX = AttackFrame->FirstChildElement("xAttackFrameX");
					if(AttackFrameX)
						temp.rAttack.left = atoi(AttackFrameX->GetText());

					TiXmlElement* AttackFrameY = AttackFrame->FirstChildElement("xAttackFrameY");
					if(AttackFrameY)
						temp.rAttack.top = atoi(AttackFrameY->GetText());

					TiXmlElement* AttackFrameW = AttackFrame->FirstChildElement("xAttackFrameW");
					if(AttackFrameW)
						temp.rAttack.right = atoi(AttackFrameW->GetText());

					TiXmlElement* AttackFrameH = AttackFrame->FirstChildElement("xAttackFrameH");
					if(AttackFrameH)
						temp.rAttack.bottom = atoi(AttackFrameH->GetText());
				}

				TiXmlElement* AnchorPoint = FrameType->FirstChildElement("xAnchorPoint");
				if(AnchorPoint)
				{
					TiXmlElement* AnchorPointX = AnchorPoint->FirstChildElement("xAnchorPointX");
					if(AnchorPointX)
					{
						int ax = atoi(AnchorPointX->GetText());
						temp.ptAnchor.x =  ax - temp.rRender.left;
					}

					TiXmlElement* AnchorPointY = AnchorPoint->FirstChildElement("xAnchorPointY");
					if(AnchorPointY)
					{
						int ay = atoi(AnchorPointY->GetText());
						temp.ptAnchor.y = ay - temp.rRender.top;
					}
				}
			}
			a.SetTimeDelay(temp.fTime);

			temp.rAttack.right +=  temp.rAttack.left;
			temp.rAttack.bottom += temp.rAttack.top;
			temp.rAttack.left -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rAttack.top -= (temp.ptAnchor.y + temp.rRender.top);
			temp.rAttack.right -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rAttack.bottom -=(temp.ptAnchor.y + temp.rRender.top);

			temp.rCollision.right +=  temp.rCollision.left;
			temp.rCollision.bottom += temp.rCollision.top;
			temp.rCollision.left -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rCollision.top -= (temp.ptAnchor.y + temp.rRender.top);
			temp.rCollision.right -= (temp.ptAnchor.x + temp.rRender.left);
			temp.rCollision.bottom -=(temp.ptAnchor.y + temp.rRender.top);

			a.addFrame(temp);
			xFrame = xFrame->NextSiblingElement("xFrame");
		}
		a.SetImageID(tempID);
		vAnimation2.push_back(a);

		xAnimation = xAnimation->NextSiblingElement("xAnimation");
	}
	return true;
}

void CMasterHand::PourOil()
{
	HotOilTimer = 3.0f;
	HotOilCoolDown = 0.0f;
}
void CMasterHand::FireBallista()
{
	BallistaTimer = 3.0f;
	BallistaCoolDown = 0.0f;
}

void CMasterHand::BuyArcher()
{
	int offset = rand()% 100;
	MessageSystem::GetInstance()->SendNewMessage(new CCreateRangedEnemyMessage(560.0f + offset, 520.0f, 1, CGamePlayState::GetInstance()->GetHand()->GetLevel()));
	ArcherCoolDown = 0.0f;
	ArcherLevel++;
}

void CMasterHand::EquiptRock()
{
	rockEquiped = true;
	poison = false;
	currAnimation = HAND_IDLE;
	rockTimer = 0.5f;
	poisoned = false;
}

void CMasterHand::EquiptPoison()
{
	if(poisonCooldown > 0)
	{
		holdingPinch = false;
		holdingEnemy = false;
		rockEquiped = false;
		poison = true;
		currAnimation = HAND_POISON;
		scale = .7f;
		poisoned = true;
	}
}

void CMasterHand::EquiptPinch()
{
	rockEquiped = false;
	poisoned = false;
	poison = false;
	currAnimation = HAND_IDLE;
	scale = 1.5f;
}

void CMasterHand::RockLevelUp()
{
	RockLevel++;
}